﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewRequest.aspx.cs" Inherits="InvoiceApplication.NewRequest" %>

<%@ Register Src="../../Processes/ProcessControl/UserInfo.ascx" TagName="UserInfo"
    TagPrefix="ui" %>
<%@ Register Src="../../Processes/ProcessControl/ApprovalHistory.ascx" TagName="ApprovalHistory"
    TagPrefix="ah" %>
<%@ Register Src="../../Processes/ProcessControl/Attachments.ascx" TagName="Attachments"
    TagPrefix="attach" %>
<%@ Register Src="../../Processes/ProcessControl/ButtonList.ascx" TagName="ButtonList"
    TagPrefix="btn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>发票申请</title>
    <script src="../../js/jquery.js" type="text/javascript"></script>
    <script src="../../js/common.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            //getSumJE();
            //$("#txt_BXJEDX").text($("#fld_BXJEDX").val());
            //$("#lbbxje").text($("#fld_BXJE").val());
            //            $('#fld_BXJE').bind('blur', function () {
            //                getSumJE();
            //            });
            //            $('#fld_BXJE').bind('keyup', function () {
            //                getSumJE();
            //            });
        });
        function changeRMB() {
            var JE = $("#fld_BXJE").val();
            var STRRMB = ChangeRMB(JE);
            $("#fld_BXJEDX").val(STRRMB);
            $("#txt_BXJEDX").text(STRRMB);
        }
        function getSumJE() {
            var Sum_JE = 0;
            $("#tbDetail tr:gt(0)").each(function (i, Etr) {
                var JE = $(Etr).find("td:eq(8)").children().val() - 0;
                if (!isNaN(JE)) {
                    Sum_JE += JE;
                }
                else {
                    $(Etr).find("td:eq(8)").children().val("");
                }
            });
            //$("#lbbxje").text(Sum_JE);
            $("#fld_INVOICEAMOUNT").val(Sum_JE);
            //changeRMB();
        }

        function selectPage1() {
            rtn = selectPage("SELECT RESOURCEID,CNNAME,ENNAME FROM COM_RESOURCE WHERE TYPE='COMPANY'", "ENNAME", "CNNAME,ENNAME", "中文名,英文名", "100,50", "选择付款公司");
            if (rtn) {
                $("#fld_FKCOMPANY").val(rtn.CNNAME);
            }
            return false;
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div class="row">
            <ui:userinfo id="UserInfo1" processtitle="发票申请" processprefix="FP" tablename="PROC_INVOICE"
                tablenamedetail="PROC_INVOICE_DT" runat="server"></ui:userinfo>
        </div>
        <div class="row">
            <table class="table table-condensed table-bordered">
                <tr>
                    <td class="banner" colspan="4">
                        详细信息
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        开票公司：
                    </td>
                    <td class="td-content">
                        <asp:DropDownList ID="fld_KPCOMPANY" runat="server" CssClass="validate[required]  ">
                            <asp:ListItem Selected="True">南京全力广告有限公司</asp:ListItem>
                            <asp:ListItem>XX广告有限公司</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td class="td-label">
                        付款公司：<span class="red">*</span>
                    </td>
                    <td class="td-content">
                        <asp:TextBox ID="fld_FKCOMPANY" runat="server" CssClass="validate[required]  "></asp:TextBox>
                        <asp:Button ID="Button1"
        runat="server" Text="..." CssClass="btn" OnClientClick="return selectPage1();" />
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        发票金额：
                    </td>
                    <td class="td-content">
                        <asp:TextBox ID="fld_INVOICEAMOUNT" runat="server" CssClass="readonly"></asp:TextBox>
                    </td>
                    <td class="td-label">
                        发票类型：
                    </td>
                    <td class="td-content">
                        <asp:DropDownList ID="fld_INVOICETYPE" runat="server">
                            <asp:ListItem Selected="True">增值税专用发票</asp:ListItem>
                            <asp:ListItem>普通发票</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="td-label">
                        销项税率：
                    </td>
                    <td class="td-content">
                        <asp:DropDownList ID="fld_RATE" runat="server">
                            <asp:ListItem Selected="True">6</asp:ListItem>
                            <asp:ListItem>17</asp:ListItem>
                        </asp:DropDownList>
                        %
                    </td>
                    <td class="td-label">
                        发票摘要：
                    </td>
                    <td class="td-content">
                        <asp:TextBox ID="fld_INVOICESUMMARY" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="td-label" valign="middle">
                        备注：
                    </td>
                    <td class="td-content" colspan="3">
                        <asp:TextBox TextMode="MultiLine" ID="fld_REMARK" Width="98%" Height="60px" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="10">
                        <table class="table table-condensed table-bordered tablerequired" id="tbDetail">
                            <tr>
                                <th>
                                    订单编号
                                </th>
                                <th>
                                    开始日期
                                </th>
                                <th>
                                    结束日期
                                </th>
                                <th width="100px">
                                    付款项目
                                </th>
                                <th>
                                    项目代号
                                </th>
                                <th>
                                    产品名称
                                </th>
                                <th>
                                    品牌
                                </th>
                                <th>
                                    应收日期
                                </th>
                                <th>
                                    应收金额
                                </th>
                                <th>
                                    <asp:Button ID="btnAdd" runat="server" Text="增加" CssClass="btn" CausesValidation="false"
                                        OnClick="btnAdd_Click" />
                                </th>
                            </tr>
                            <asp:Repeater ID="fld_detail_PROC_INVOICE_DT" runat="server" OnItemCommand="fld_detail_PROC_INVOICE_DT_ItemCommand">
                                <ItemTemplate>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="fld_FORMID" Text='<%#Eval("FORMID") %>' runat="server" Style="display: none"></asp:TextBox>
                                            <asp:TextBox ID="fld_ORDERNO" Text='<%#Eval("ORDERNO") %>' runat="server" Width="90%"
                                                CssClass="validate[required]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_STARTDATE" Text='<%#ProcessControl.Format.GetDate(Eval("STARTDATE"))%>' runat="server" Width="90%"
                                                OnClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})" CssClass="Wdate validate[required,custom[date]]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_ENDDATE" Text='<%#ProcessControl.Format.GetDate(Eval("ENDDATE")) %>' runat="server" Width="90%"
                                                OnClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})" CssClass="Wdate validate[required,custom[date]]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_FKPROJECT" Text='<%#Eval("FKPROJECT") %>' runat="server" Width="90%"
                                                CssClass="validate[required]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_PROJECTCODE" Text='<%#Eval("PROJECTCODE") %>' runat="server"
                                                Width="90%" CssClass="validate[required]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_PRODUCT" Text='<%#Eval("PRODUCT") %>' runat="server" Width="90%"
                                                CssClass="validate[required]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_BRAND" Text='<%#Eval("BRAND") %>' runat="server" Width="90%"
                                                CssClass="validate[required]">></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_YSDATE" Text='<%#Eval("YSDATE") %>' runat="server" Width="90%"
                                                OnClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})" CssClass="Wdate validate[required,custom[date]]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="fld_YSAMOUNT" Text='<%#Eval("YSAMOUNT") %>' onblur="getSumJE()"
                                                onkeyup="getSumJE()" runat="server" Width="90%" CssClass="validate[required]"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:Button ID="btnDelete" runat="server" Text="删除" CssClass="btn" CommandName="del"
                                                ClientIDMode="Static" OnClientClick="return confirm('确认删除？')" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div class="row">
            <attach:attachments id="Attachments1" runat="server"></attach:attachments>
        </div>
        <div class="row">
            <ah:approvalhistory id="ApprovalHistory1" showaction="false" runat="server"></ah:approvalhistory>
        </div>
        <div class="row">
        </div>
    </div>
    <btn:buttonlist id="ButtonList1" runat="server"></btn:buttonlist>
    <div style="display: none;">
    </div>
    </form>
</body>
</html>
